<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <meta http-equiv="X-UA-Compatible" content="IE=EDGE,chrome=1" />
    <meta name="renderer" content="webkit" />
    <link href="__STATIC__/index/css/quan_common.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" type="text/css" href="__STATIC__/index/css/quan_list_top.css" />
    <link rel="stylesheet" type="text/css" href="__STATIC__/index/css/bangdan.css" />
    <link rel="stylesheet" type="text/css" href="__STATIC__/index/css/collect.css" />
    <link rel="stylesheet" href="__STATIC__/layui/css/layui.css" />
    <link rel="stylesheet" href="__STATIC__/layer/theme/default/layer.css" />
    <script type="text/javascript" src="__STATIC__/index/js/jquery-3.2.1.js"></script>
    <script src="__STATIC__/index/js/clipboard.min.js"></script>
    <script src="__STATIC__/layui/layui.js"></script>
    <script src="__STATIC__/layer/mobile/layer.js"></script>
    <style>
        .dtk-head .head-search .head-search-right {
            background: url(img/live-img.png) 0 -294px no-repeat;
        }

        .dtk-head .head-nav .nav-main .nav-list ul li.nav-list-li-fr i.app_u {
            background: url(img/common_nav_icon-u.png);
        }

        .dtk-head .head-nav .nav-main .nav-list ul li.nav-list-li-fr .app_up {
            background: url(img/live-img.png) -91px 2px no-repeat;
        }

        .dtk-head .head-nav .nav-main .nav-list ul li.nav-list-li-fr .app_up {
            background: url(img/live-img.png) -91px 2px no-repeat;
        }

        .dtk-head .head-nav .nav-main .nav-list ul li a {
            background: url(img/nav-split-line.jpg) right center no-repeat;
        }

        .screen_icon {
            background: url(img/screen_icon.png) no-repeat;
        }

        .goods-pages-page .pagebtn {
            background: url(img/screen_icon.png) -78px -3px rgba(255, 255, 255, 1);
        }

        .dtk-head .head-nav .nav-main .nav-list ul li i.sf_new,
        .goods-pages .goods-pages-fil span i.sf_new {
            background: url(img/live-img.png) -192px -125px no-repeat;
        }

        .goods-item .goods-item-content .goods-img span.goods-lyb,
        .goods-item .goods-item-content .goods-img span.goods-new {
            background: url(img/live-img.png) -256px -65px no-repeat
        }

        .goods-info .tag i,
        .goods-info-tj .goods-sale .tag i {
            background: url(img/live-img.png) -353px -125px no-repeat;
        }

        .com_footer .h_icon,
        .com_header .h_icon,
        .nav-header-ext .h_icon {
            background: url(img/h_icon.png);

        }
        .nav-header-ext .h_icon {
            background-position: -486px -230px;
        }
        .dtk-head .head-search .search .search-submit span{
            background: url(img/live-img.png) -133px -253px no-repeat;
        }
        .hide_type{
    		display: flex;
    		flex-direction: row;
    		justify-content: space-between;
    		margin-top: 10px;
                  }
    	.hide_type>div{
    		padding:5px 10px;
    		font-size: 16px;
    		border-radius: 5px;
    		cursor:pointer;
    		     }
    </style>
    <title>终极推</title>
</head>
<script type="text/javascript">
	function shorturl(id,sp_id,goods_id){
		$.ajax({
			type:"post",
			url:"{:url('index/link/shorturl')}",
			data:{id:id,sp_id:sp_id},
			success:function(res){
			  if(res.code==0 || res.code==2){
			  	 layui.use('layer', function(){
				  var layer = layui.layer;
				  layer.alert(res.msg, {icon: 2});
					});
			 		return false;
			  }else{
			    $('#voucher'+goods_id).hide();
			    $('#xiadan'+goods_id).text(res.content);
			    layer.msg('转链接成功');
			  }
			}
		});
	}

	function ambush(id,sp_id,goods_id){
		$.ajax({
			type:"post",
			url:"{:url('index/link/ambush')}",
			data:{id:id,sp_id:sp_id,goods_id:goods_id},
			success:function(res){
			  if(res.code==0 || res.code==2){
			  	 layui.use('layer', function(){
				  var layer = layui.layer;
				  layer.alert(res.msg, {icon: 2});
					});
			 		return false;
			  }else{

			    $('#voucher'+goods_id).hide();
			    $('#xiadan'+goods_id).text('复制这条信息 '+res.model+',打开→手机淘宝←即可查看并下单');
			    layer.msg('转链接成功');
			  }
			}
		});
	}

      //评论功能
   function review(id){
   	layui.use('layer', function(){
			  var layer = layui.layer;
//			  layer.alert(res.msg, {icon: 2}
			  	 layer.open({
        type: 2
        ,closeBtn: false
        ,area: ['700px','500px']
        ,shade: 0.8
        ,offset: [ //为了演示，随机坐标
          Math.random()*($(window).height()-300)
          ,Math.random()*($(window).width()-390)
        ]
        ,id: 'LAY_layuipro' //设定一个id，防止重复弹出
        ,offset: "auto"
        ,moveType: 0 //拖拽模式，0或者1
        ,content: "{:url('index/review')}?id="+id
        ,btn: ['全部关闭'] //只是为了演示
        ,btn1: function(){
          layer.closeAll();
        }
        ,zIndex: layer.zIndex //重点1
        ,success: function(layero){
          layer.setTop(layero); //重点2
        }
		    });
  })
}

</script>

<body>

    <script src="__STATIC__/index/js/top.js"></script>

    <div id="count_pd" class="count"> </div>
    <div class="dtk-head clearfix">
        <div class="head-top">
            <div class="head-top-main">
                <div class="head-top-left clearfix">
                 <a class='dtk-info fl' href="{:url('index/index/index')}">终极推首页</a>
             <div id="header_login" class="fl">
            <div class="login-in ">
              <div class="login-profile login-profile-nick ">
                <span class="wel-msg">
                  <a href="#"><b>{$mobile}</b></a>
                  <i></i>
                </span>
                <div class="login-option" style="width: 110px; text-align: center">
                  <a href="{:url('index/personal/centre')}">我的信息</a>
                  <a href="{:url('index/personal/security')}">帐号安全</a>
                  <a href="{:url('index/index/quit')}">退出登录</a>
                </div>
              </div>
              <a href="{:url('index/market/index')}" style="margin:0 5px;">推广中心<i></i></a>
              <a href="{:url('index/seller/application')}" class="sale-center">放单中心<span id="top_msg" class="top_msg" style="display: inline;"></span></a>
            </div>
            <!--登陆后个人中心-->
          </div>
                <div id='header_login' class='fl'>
                </div>
                </div>
                <div class="head-top-right">
                    <a href="#">招商入驻</a>
                    <a href="#">商家合作</a>
                    <a href="#">帮助中心</a>
                    <a href="#">联系我们</a>
                </div>
            </div>
        </div>
        <div class="head-search">
            <div class="logo fl"><a href="#" title="终极推首页" class="link_home">首页</a><a href="#" class="link_qlist" title="选品库">选品库</a></div>
            <div class="search fl">
                <div class="select-area">
                    <div id="xuan" class="hide sear-option">
                        <span class="cur" data-value="keyword">标题</span>
                        <span data-value="keyword_miaoshu">标题和文案</span>
                        <span data-value="spid">商品ID</span>
                    </div>
                </div>
                <div class="search-input">
                    <input id="keywords" type="text" name="keywords" autocomplete="off" placeholder="请输入关键词/商品ID/商品链接" value='{neq name="condition.keywords" value="0"}{$condition.keywords}{/neq}'>
                    <span class="src-close-btn"></span>
                    <ul class="search-land"></ul>
                </div>
                <span id='search_a_tag' onclick="get_collect_goods();" class="search-submit fr"><span></span></span>
                <div>
                    <a class="gjz" href="#">保温杯</a>
                    <a class="gjz" href="#">睡衣</a>
                    <a class="gjz" href="#">抽纸</a>
                    <a class="gjz" href="#">挡风被</a>
                    <a class="gjz" href="#">卫衣</a>
                </div>
            </div>

            <div class="head-search-right fr"></div>
        </div>
        <a class="banner-flex" style="cursor: inherit;"><img class="topbanner" src="#" alt="">
            <img src="https://img.alicdn.com/imgextra/i1/2053469401/O1CN012JJhsaRVq8lFZyF-2053469401.jpg" class="topbanner">
        </a>
        <div class="main">
            <div class="wrapper sale layui-form" ui-mta="clickStat" data-event="show" data-mta-key="xpk_1006" data-config="{title:'实时榜'}">
                <ul class="goods-top clearfix">
                    <a href="javascript:;" onclick="get_collect_time(1);">
                        <li class="goods-top-type  active" id="type1">
                            <i class="ico ic2"></i>
                            <div class="tit-block">
                                <p class="tit">全部商品</p>
                                <p class="des">全部收藏的商品</p>
                            </div>
                        </li>
                    </a>
                    <a href="javascript:;" onclick="get_collect_time(2);">
                        <li class="goods-top-type " id="type2">
                            <i class="ico ic4"></i>
                            <div class="tit-block">
                                <p>今日收藏</p>
                                <p class="des">今日收藏的商品</p>
                            </div>
                        </li>
                    </a>
                    <a href="javascript:;" onclick="get_collect_time(3);">
                        <li class="goods-top-type " id="type3">
                            <i class="ico ic4"></i>
                            <div class="tit-block">
                                <p>失效收藏</p>
                                <p class="des">失效收藏的商品</p>
                            </div>
                        </li>
                    </a>

                    <img class="sale_nav_img" src="__STATIC__/index/img/salenavimg.png" alt="">
                </ul>
                <a class="check-time goods_top_gx" ui-mta="clickStat" data-event="click" data-mta-key="xpk_1006" data-config="{title:'点击刷新',from:'实时销量榜'}"
                style="display: none" data-show="1" data-url="top_check.html?t=1539844586&type=1" href="javascript:window.location.reload();">已更新！<span>点此查看</span>最新排名。（每10分钟更新）</a>

                <div class="nav-block">
                    <ul class="saleNum-nav">
                        <li class="curl cate cate0"><a href="javascript:;" onclick="get_cate_id(0)">全部</a></li>
                        {volist name="data" id="vo"}
                            <li class="cate{$vo.id} cate">
                                <a href="javascript:;" onclick="get_cate_id({$vo.id})">{$vo.name}</a>
                            </li>
                        {/volist}
                    </ul>
                </div>
                <!--没有商品-->
                <div class="no-goods">
                    <span class="img"></span>
                    <p class="tit">抱歉，暂无榜单数据</p>
                    <p class="des">所有商品都很平静，请稍后再来~</p>
                    <span class="link">如您发现数据异常，请<a href="#">反馈给攻城狮</a></span>
                </div>
                <div class="goods-list goods-list-ss clearfix">
                {volist name="collects" id="vo" key="k"}
                    <div id="goods-items_16781492" class="goods-item">
                        <div class="goods-item-content">
                            <div class="rankNum">{$k}</div>
                            <div class="goods-img">
                                <a class="item" href="{$vo.goods.web_address}">
                                    <img class="lazy img" src="{$vo.goods.large_img}">
                                </a>
                                <span onclick="cancel_collect({$vo.goods.id})" class="fl quan_add_u go_info"><p>取消收藏</p><span></span></span>
                                <div class="copy_text fr">
                                    <span class="copy_text_btn" id="copy_text_btn{$vo.goods.id}" onclick="copy({$vo.goods.id})">复制文案</span>
                                    <div class="copyText copyRight" style="top: -156px;" id="copyRight{$vo.goods.id}">
                                        <!-- <img src="https://img.alicdn.com/imgextra/i4/1935371611/O1CN011NlsWODyiod2Gi8_!!1935371611.jpg_310x310.jpg"> -->
                                        <img src="{$vo.goods.large_img}" alt="">
                                        <br>
                                        {$vo.goods.title}
                                        <br>
                                        券后{$vo.goods.last_price}包邮秒杀
                                        <br>
                                        {$vo.goods.coupon_price}元优惠券:
                                        <a href="#" id = "voucher{$vo.goods.id}">{$vo.goods.coupon_address}</a><br>下单链接:
                                        <a href="#" id = "xiadan{$vo.goods.id}">{$vo.goods.web_address}</a>
                                        <br>
                                        {$vo.goods.letters}
                                    </div>
                                </div>
                            </div>
                            <div class="goods-info">
                                <div class="goods-tit">
                                    <span class="goods-tit-txt">
                                        <a href="#" ui-mta="clickStat" data-event="click" data-mta-key="xpk_1007" data-config="{gid:'16781492',cid:'10',price:'29.9',coupon:'10',title:'标题链接',num:'1',from:'实时销量榜'}">
                                            {$vo.goods.title} </a>
                                    </span>
                                </div>
                                <div class="goods-slider" title="优惠券已领取  {$vo.goods.sy_coupon_nums}  张">
                                    <span class="slider"><em data-width="10%"></em></span>
                                </div>
                                <div class="goods-qjy">
                                    <div class="goods-price">
                                        <span>券后价</span><p><b><i class="rmb-style">￥</i>{$vo.goods.last_price}</b><i class="line"></p>
                                    </div>
                                    <div class="goods-quan">
                                        <span>优惠券</span><p><b><i class="rmb-style">￥</i>{$vo.goods.coupon_price}</b><i class="line"></p>
                                    </div>
                                    <div class="goods-yj" title="佣金 {$vo.goods.last_price*$vo.goods.commision/100} 元">
                                        <span>
                                                                                               营销计划 </span>
                                        <p>{$vo.goods.commision}<b>%</b></p>
                                    </div>
                                </div>
                                <div class="goods-sale">
                                    <span>月销量<b>{$vo.goods.sale_volume}</b></span>
                                    <div class="tag clearfix">
                                      <i class="tag-ju"></i><i class="tag-tmall"></i><span onclick="review({$vo.goods.id})" style="cursor:pointer;">评论</span> </div>
                                </div>
                                <div class="hide-block">
                                    <div class="type">
                                        <span class="margin-num">优惠券剩余：<b>{$vo.goods.sy_coupon_nums}</b>/{$vo.goods.coupon_nums}</span>
                                    </div>
                                    <div class="shop">
                                        <span class="qlist-shop"></span>
                                    </div>
                                    <div class="goods-author">
                                        <span>放单人：</span><span class="goods_team_name" data_tk_zs_id="19625189">{$vo.goods.seller.username}</span>
                                    </div>
                                    <div class="hide_type">
                                    	<div style="background: #fc6653;color: #fff;" id="shorturl" onclick="shorturl({$vo.id},{$vo.goods.sp_id},{$vo.goods.id})">短链接</div>
                                    	<div style="background: #218acb;color: #fff;" id="ambush" onclick="ambush({$vo.id},{$vo.goods.sp_id},{$vo.goods.id})">淘口令</div>
                                    </div>

                                </div>
                            </div>
                        </div>
                    </div>
                {/volist}
                </div>
            </div>
        </div>
        <div class="side-bar">
            <div class="side-bar-list">
                <!-- 今日 -->
                <div class="side-bar-herald side-bar-item">
                    <a href="#"><i></i><em>客服中心</em></a>
                </div>
                <!-- 预告 -->
                <div class="side-bar-feedback side-bar-item">
                    <a href="#"><i></i><em>意见反馈</em></a>
                </div>
                <!-- 反馈 -->
                <div class="side-bar-favorite side-bar-item">
                    <a href="#"><i></i><em>我的收藏</em></a>
                </div>
                <div class="side-bar-top side-bar-item">
                    <a href="#" class="scrollTop"><i></i><em>返回顶部</em></a>
                </div>
            </div>
        </div>
        <div style="left: 0px; top: 0px; position: absolute; width: 29px; height: 27px; border: medium none; margin: 0px; padding: 0px; z-index: 2147483647; display: none;"
        class="sbi_search" id="sbi_camera_button"></div>
    </body>
    <script>
        $(".saleNum-nav li").on("click", function () {
            $(this).addClass("curl");
            $(this).siblings("li").removeClass("curl");
            console.log("点击了span")
        })
        $(".goods-top-type").on("click", function () {
            $(".goods-top").find(".goods-top-type").removeClass("active");
            $(this).addClass("active");
        })
        $(".copy_text").on("click",function(){
            console.log("点击复制文案");
        })

        //复制功能
		    function copy(e){
			      var clipboard = new Clipboard('#copy_text_btn'+e, {
		   	        target: function() {
		   		          return document.querySelector('#copyRight'+e);
		   	        }
		        });
        }
    </script>
    <script src="__STATIC__/layer/layer.js"></script>
    <script>
        var cate = {
            'keywords':'{$condition.keywords}',
            'type':{$condition.type},
            'cate_id':{$condition.cate_id},
        };
        $('.goods-top-type').removeClass('active');
        $('#type'+cate.type).addClass('active');
        $('.cate').removeClass('curl');
        $('.cate'+cate.cate_id).addClass('curl');
        
        var url =  window.location;
        // alert(url);
        var param = '/index/Index/collect/'+location.search+'&';

        function get_collect_goods() {
            var keywords = $('#keywords').val();
            window.location.href= '/index/Index/collect/&keywords='+keywords;
        }

        function get_collect_time(type) {
        	
            cate.type = type;
            window.location.href = '/index/Index/collect/&type='+type;
           
            
        }

        function get_cate_id(cate_id) {
            cate.cate_id = cate_id;
            redirectUrl();
        }

        function redirectUrl() {
            var type = GetParam(param,'type');
            if(cate.type){
                if(type && type != undefined){
                    param = param.replace(/(?![?&])(b)=\w+/gi,"type="+cate.type);
                }else{
                    param = param+'type='+cate.type+'&';
                }
            }

            var cate_id = GetParam(param,'cate_id');
            if(cate.cate_id){
                if(cate_id && cate_id != undefined){
                    param = param.replace(/(?![?&])(b)=\w+/gi,"cate_id="+cate.cate_id);
                }else{
                    param = param+'cate_id='+cate.cate_id+'&';
                }
            }
            window.location.href = param;
        }

        function GetParam(url, id) {
            url = url+ "";
            regstr = "/(\\?|\\&)" + id + "=([^\\&]+)/";
            reg = eval(regstr);//eval可以将 regstr字符串转换为 正则表达式
            result = url.match(reg);//匹配的结果是：result[0]=?sid=22 result[1]=sid result[2]=22。所以下面我们返回result[2]

            if (result && result[2]) {
                return result[2];
            }
        }

        function cancel_collect(goods_id) {
            $.post('{:url("collecting")}',{'id':goods_id},function(data){
                if(data.code == 1){

                        window.location.reload();

                }else{
                    layer.msg(data.msg, {icon: 5,time:1500,shade: 0.1});
                }
            },'json');
        }
    </script>
</html>
